package meb

import (
	"github.com/mosongcc/gotool/gcache"
	"gorm.io/gorm"
	"vitepress-serve/internal/service"
)

type Controller struct {
	db            *gorm.DB
	cache         gcache.Cache
	ConfigService *service.ConfigService
	WxpayService  *service.WxpayService
	OrderService  *service.OrderService
}

func NewController(db *gorm.DB) *Controller {

	configService := service.NewConfigService(db)

	return &Controller{
		db:            db,
		cache:         gcache.Memory,
		ConfigService: configService,
		WxpayService:  service.NewWxpayService(configService),
		OrderService:  service.NewOrderService(db),
	}
}
